Skip to content

feat(telemetry): add the Claude Code telemetry adapter (2/4, GRO-305) - #27

Open
teallarson wants to merge 2 commits into
mainfrom
cursor/telemetry-claude-a3a4
Open

teallarson wants to merge 2 commits into
mainfrom
cursor/telemetry-claude-a3a4

Conversation

@teallarson

@teallarson teallarson commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Part of GRO-305 · issue

What/why

Prepares Claude Code to measure when a prompt may benefit from Arcade and whether Arcade is used, including tool failures and operator completion status. These measurements would add client-side context that server call logs cannot provide. Collection stays disabled: this PR leaves shipped hooks unchanged and sends no telemetry.

Codebase changes

Adds a Claude Code adapter to the existing telemetry hook generator. It maps prompt, tool, and subagent callbacks into the shared event format, identifies Arcade versus other tools, and honors Claude-specific opt-outs. Fixtures and tests cover event mapping, turn scope, opt-outs, generated hook wiring, and the disabled runtime.

Additional notes

Current-head CI passes tests and all four client validators. Disabled-runtime tests verify that hooks emit no output or telemetry, with a positive control to confirm the test can detect a send. Live Claude delivery, Windows behavior, and production ingestion remain unverified. Enabling collection requires a separate reviewed change and privacy approval.

— Strider 🐦‍⬛, Teal's agent · approved by Teal.


Note

Medium Risk
Introduces client-specific telemetry classification and future hook wiring for prompts and tool use; behavior is gated off in shipped manifests but touches privacy-sensitive observation paths when enabled.

Overview
Adds a Claude Code–specific telemetry adapter and registers it on the claude-code host via telemetry: "claude-code" in hook-hosts.mjs, so the shared hook generator and telemetryHookRows() can emit the intended wiring when collection is turned on.

The new hooks/telemetry-adapters/claude-code.mjs maps Claude hook payloads to contract events: Arcade vs claude_ai MCP tool prefixes, auth status from System_ManageAuthorization, operator subagent stop parsing, scoped vs always-on observation (requiresTurn), Claude opt-outs (DISABLE_TELEMETRY, CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC as any non-empty value), and hook rows for prompts, PreToolUse (Arcade matchers), PostToolUse/Failure (MCP, WebFetch/WebSearch, per-CLI Bash with if + --cli).

Tests and fixtures cover end-to-end event mapping, turn scope/TTL, opt-outs, manifest parity with hooks.enabled.json, and that the checked-in .claude-plugin/hooks.json still has no telemetry.mjs while the global OFF gate remains false.

Reviewed by Cursor Bugbot for commit 45edb2c. Bugbot is set up for automated code reviews on this repo. Configure here.

@teallarson

Copy link
Copy Markdown
Contributor Author

@BugBot review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1c51f07. Configure here.

@teallarson teallarson left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent final review at 1c51f07f115d5b3965b133368e542b37b13719ae: ready for human review with telemetry OFF.

Independent mapping/opt-out review: 21 focused tests, typecheck, generation and all 19 literal enabled-fixture shell commands silent while OFF. No remaining code finding.

Ready-for-review CI passed tests, all four client checks and the required aggregate gate; current-head Cursor Bugbot is green. Final combined heads plus main 18c7c99 passed 170/170 tests, zero skips, typecheck, four validators and 13 generated outputs. Independent combined privacy/release/adapter-removal review found no new blocker.

Windows, live client delivery and production ingestion remain activation prerequisites. No merge, release or collection enablement is authorized by this review. Descriptions preserve own-base review maps and limitations; Teal will inspect and request human reviewers.

— Strider 🐦‍⬛, Teal's agent · approved by Teal

@teallarson teallarson changed the title Add the Claude Code telemetry adapter (2/4, GRO-305) feat(telemetry): add the Claude Code telemetry adapter (2/4, GRO-305) Oct 7, 2026
Base automatically changed from cursor/telemetry-foundation-a3a4 to main October 12, 2026 16:55
cursoragent and others added 2 commits October 12, 2026 19:08
Replays the net #27 slice (old foundation 2671030..1c51f07) onto main
6f4cdc7, which now contains the squash-merged foundation (#26).
Telemetry stays hard-OFF (TELEMETRY_ENABLED = false).

Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
…n gate

The 19 enabled-fixture commands were fed a SessionStart input, which maps to
no event, so the test passed even with TELEMETRY_ENABLED flipped true. Feed
a sendable prompt, clear inherited Claude opt-outs, and add a positive
control that the loopback capture server observes a direct send.

Co-authored-by: Teal Larson <LARSON.TEAL@GMAIL.COM>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants